[#include "../../dbadminer/common/html.ftl" /]
[@html]
    [@head_dbadminer title="${databaseName!'SQL编辑器'}" css=["fw", "contextMenu", "db-common", "codemirror", "sql"] ]
        <style>
            .fw-layout > .fw-container > .fw-content {
                box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.2);
            }
        </style>
    [/@head_dbadminer]
    [@body class="fw-white-bg"]
        [#--主体内容--]
        [@main group="${connectGroup!}"]
            [#--操作栏--]
            <div class="fw-db-buttons">
                <div class="am-u-sm am-margin-0 am-padding-0 fw-db-buttons-left">
                    <div class=" am-btn-group fw-db-oper-btn" style="border-color: transparent;">
                        <select id="connect-select" placeholder=" " data-am-selected="{btnWidth: 200, maxHeight: 500, btnSize: 'sm', btnStyle: 'transparent', searchBox: 1}" >
                            <option value=""></option>
                            [#if connects??]
                                [#list connects as connect]
                                    [#if connect.id == connectId!]
                                        <option icon="icon-${connect.type!}" data-connect_group="${connect.groupFlag!}" value="${connect.id!}" selected>${connect.name!}</option>
                                    [#else ]
                                        <option icon="icon-${connect.type!}" data-connect_group="${connect.groupFlag!}" value="${connect.id!}">${connect.name!}</option>
                                    [/#if]
                                [/#list]
                            [/#if]
                        </select>
                        <select id="database-select" placeholder=" " data-am-selected="{btnWidth: 200, maxHeight: 500, btnSize: 'sm', btnStyle: 'transparent', searchBox: 1}" >
                            <option value=""></option>
                            [#if databases??]
                                [#list databases as database]
                                    [#if database == databaseName!]
                                        <option icon="am-icon-database" value="${database!}" selected>${database!}</option>
                                    [#else ]
                                        <option icon="am-icon-database" value="${database!}">${database!}</option>
                                    [/#if]
                                [/#list]
                            [/#if]
                        </select>
                        <a id="fw-toolbar-execute" href="##" class="am-btn am-btn-sm am-btn-transparent am-icon-play" onclick="execute(sql_oper_type.EXECUTE)"> 运行</a>
                        <a id="fw-toolbar-explain" href="##" class="am-btn am-btn-sm am-btn-transparent am-icon-stethoscope am-hide" onclick="execute(sql_oper_type.EXPLAIN)"> 解释</a>
                        <a id="fw-toolbar-stop" href="##" class="am-btn am-btn-sm am-btn-transparent am-icon-stop am-hide" onclick="execute(sql_oper_type.STOP)"> 停止</a>
                        <span style="color: #aaaaaa;line-height: 32px;margin-left: 0px;">（提示：在SQL编辑器中按“F11”可全屏或退出全屏）</span>
                    </div>
                </div>
                <div class="am-u-sm am-margin-0 am-padding-0 fw-db-buttons-right">
                    <div class="am-btn-group fw-db-oper-btn" style="border-color: transparent;">
                        <a id="fw-toolbar-import" class="am-btn am-btn-sm am-btn-transparent am-icon-upload am-hide"> 导入数据</a>
                        <a id="fw-toolbar-export" class="am-btn am-btn-sm am-btn-transparent am-text-warning am-icon-download am-hide" onclick="execute(sql_oper_type.EXPORT)"> 导出结果</a>
                        <a id="fw-toolbar-columns" class="am-btn am-btn-sm am-btn-transparent am-icon-columns am-hide"> 自定义列</a>
                        <a id="fw-toolbar-search" class="am-btn am-btn-sm am-btn-transparent am-hide">显示/隐藏SQL编辑器</a>
                    </div>
                </div>
            </div>

            [#--内容块--]
            <div class="fw-db-contents">
                [#--SQL编辑器--]
                <div class="fw-sql-editor" style="display: block;">
                    <form id="form-sql-search" class="am-form-inline">
                        <input type="hidden" name="clientId" value="${clientId!}">
                        <input type="hidden" name="connectId" value="${connectId!}">
                        <input type="hidden" name="databaseName" value="${databaseName!}">
                        <input type="hidden" name="page" value="1">
                        <input type="hidden" name="size" value="200">
                        <input  id="sql-code"type="hidden" name="sqlCode" value="" />
                        <textarea id="sql-code-textarea" hidden="hidden"></textarea>
                    </form>
                </div>
                [#--数据表格--]
                <div class="fw-sql-result">
                    <div class="am-tabs" data-am-tabs="{noSwipe: 1}" id="sql-tab-result">
                        <ul class="am-tabs-nav am-nav am-nav-tabs">
                            <li class="result-info"><a href="javascript: void(0)">&nbsp;信息&nbsp;</a></li>
                        </ul>
                        <div class="am-tabs-bd">
                            <div id="result-info" class="am-tab-panel result-info">
                            </div>
                        </div>
                    </div>
                </div>
                [@rightToolbar /]
            </div>

            [@footerToolbar btns=["operbtns", "operinfo", "opertime", "pageinfo", "infoview"] /]
        [/@main]

        [@script_dbadminer js=["fw", "contextMenu", "sm2", "db-common", "codemirror", "sql"]]
            <script type="text/javascript">

            </script>
        [/@script_dbadminer]
    [/@body]
[/@html]
